﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows;

namespace Tracer
{
    /// <summary>
    /// Not relevant to the example; simply performs drawing functions.
    /// </summary>
    public class CircleDrawer
    {
        private static double MAX_LIFESPAN = 10;
        private double lifespan = MAX_LIFESPAN;
        private Point centre;
        private Color color;
        private static double RADIUS = 5;

        public CircleDrawer(Point centre, Color color)
        {
            this.centre = centre;
            this.color = color;
        }

        public void Draw(DrawingContext dc)
        {
            if (IsDead)
                return;

            double currentRadius = RADIUS * (lifespan / MAX_LIFESPAN);
            dc.DrawEllipse(new SolidColorBrush(color), new Pen(new SolidColorBrush(color), 1), centre, currentRadius, currentRadius);
            lifespan -= 1;
        }

        public bool IsDead
        {
            get { return lifespan <= 0; }
        }
    }
}
